package com.petadoption.serverclient.controller;

import com.petadoption.serverclient.entity.Petbreed;
import com.petadoption.serverclient.service.IPetbreedService;
import com.petadoption.serverclient.utils.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author 汪仕杰
 * @since 2023-08-28
 */
@RestController
@RequestMapping("/petbreed")
public class PetbreedController {

    @Resource
    private IPetbreedService petbreedService;

    @Resource
    private Result result;

    @GetMapping("/{id}")
    public Result findBreedById(@PathVariable Integer id) {
        List<Petbreed> list = petbreedService.findBreedById(id);
        if (list.size() > 0) return result.success("宠物品种", list);
        return result.fail("没有品种");
    }
}
